//3.设计一个函数，把一个整型数字转成对应的字符串格式
#include<stdio.h>
void character(char c[],int x)
{
	int t = 0,m = 0,n = 0,x1 = x;
	do
	{	
		if(x1 < 0)
		{
			x1 = -x1;
			n++;
		}
		m = x1 % 10;
		t = t * 10 + m;
		n++;
		x1 = x1 / 10;
	}while(x1);
	for(int i = 0;i < n; i++)
	{
		if(x < 0)
		{
			c[0] = '-';
			x = -x;
			i++;
		}
		c[i] = t % 10 + '0';
		t = t / 10;
	}
	
}
int main()
{
	char c[20] = {'\0'};
	int x;
	printf("请输入一个整形数：");
	scanf("%d",&x);
	character(c,x);
	puts(c);
	return 0;	
}
